<%@page pageEncoding="UTF-8" isELIgnored="false"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@taglib prefix="f" uri="http://www.baka.co.jp/functions"%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="Cache-Control" content="no-cache" />
<title>スケーラブルメモ</title>
<link rel="stylesheet" type="text/css" href="/css/global.css" />
<script type="text/javascript" src="/js/jquery-1.3.2.min.js"></script>


<style type="text/css">
<!--
	span.id{
		color:green;
	}

	span.userName{
		margin-left:20px;
		color:green;
	}

	span.insertDate{
		color:black;
		margin-left:20px;
		font-size:12px;
	}
-->
</style>

<script type="text/javascript" language="JavaScript">
<!--

	$(document).ready(function(){

		//ページングプルダウンのセット
		var offsetIndex = '${offsetIndex}';
		$("#offsetIndex").val(offsetIndex);
		$("option:selected").css("backgroundColor", "#FFFF00");

	});

	function jumpPage(){
		$("#pagingForm").submit();
	}


	function actionSubmit(formId,action){

		action = './' + action;
		$("#mngForm").attr("action",action);
		$("#mngForm").submit();

	}



// -->
</script>

</head>
<body>

<h1>スケーラブルメモ</h1>

<form id="mngForm" method="POST">
	<input type="button" value="再表示"   onclick="actionSubmit('mngForm','index')"/>
	挿入数<input type="text" name="insertBatchNum" size="5" />
	<input type="button" value="一括挿入" onclick="actionSubmit('mngForm','insertBatch')"/>
	<input type="button" value="全削除"   onclick="actionSubmit('mngForm','allDelete')"/>
</form>



${gmnMessage}




<form action="./insert" method="post">

<table border="1">

	<tr>
		<th>名前</th>
		<td><input type="text" ${f:text("userName")} class="${f:errorClass('userName', 'error')}"/>${f:h(errors.userName)}</td>
	</tr>
	<tr>
		<th>内容</th>
		<td><textarea name="content" cols="100" rows="5" class="${f:errorClass('content', 'error')}">${f:h(content)}</textarea>${f:h(errors.content)}</td>
	</tr>
	<tr>
		<td colspan="2"><input type="submit" value="発言"/></td>
	</tr>
</table>

</form>

処理時間：${processTime} ms
<form id="pagingForm" action="./index" method="post">

	<select id="offsetIndex" name="offsetIndex" onchange="jumpPage();">
		<c:forEach var="o" items="${pagingOptions}">
			<option value="${o.value}">${o.label}</option>
		</c:forEach>
	</select>
</form>

<table border="0">

	<tbody>
		<c:forEach var="e" items="${bbsList}">
			<c:set var="editUrl" value="edit?key=${f:key(e.key)}&version=${e.version}"/>
			<c:set var="deleteUrl" value="delete?key=${f:key(e.key)}&version=${e.version}"/>
			<tr>
				<td><span class="id">${f:h(e.id)}</span>
					<span class="userName">${f:h(e.userName)}</span>
					<span class="insertDate"><fmt:formatDate value="${e.insertDate}" pattern="yyyy/MM/dd HH:mm SS"/></span></td>
			</tr>
			<tr>
				<td>${f:h(e.content)}</td>
			</tr>
			<tr>
				<td colspan="2"><hr/></td>
			</tr>

		</c:forEach>
	</tbody>
</table>

</body>
</html>